import 'package:dio/dio.dart';

class Http {
  static Dio? _dio;
  static Http https=Http();

  static Http getInstance(){
    return https;
  }

  Http(){
    _dio ??= createDio();
  }

  Dio createDio() {
    var dio=Dio(BaseOptions(
      connectTimeout: const Duration(milliseconds: 30000),
      receiveTimeout: const Duration(milliseconds: 30000),
      sendTimeout: const Duration(milliseconds: 30000),
      baseUrl: "",
      responseType: ResponseType.json,
    ));
    return dio;
  }

  Future<Response> get(String uri,Map<String,dynamic> param){
    return _dio!.get(uri,queryParameters: param);
  }
}